﻿#if ATS
using System.ComponentModel.DataAnnotations;
#endif
using ATS.Enums;

namespace ATS.Dto;

public class TestManufacturingCreateInput
{
    /// <summary>
    /// 所属产品的物料编码
    /// </summary>
#if ATS
    [Required(ErrorMessage = "{0}不能为空")]
    [StringLength(255, ErrorMessage = "{0}长度不能超过255")]
#endif
    public string ProductMaterialCode { get; set; }

    /// <summary>
    /// 生产工艺参数
    /// </summary>
    public TestManufacturingCreateModel[] Items { get; set; }
}

/// <summary>
/// 创建生产工艺参数
/// </summary>
public class TestManufacturingCreateModel
{
    /// <summary>
    /// 名称
    /// </summary>
#if ATS
    [Required(ErrorMessage = "{0}不能为空")]
    [StringLength(255, ErrorMessage = "{0}长度不能超过255")]
#endif
    public string Name { get; set; }

    /// <summary>
    /// 外部编码。用于对接外部系统，如：MES，同一外部系统下唯一。
    /// </summary>
#if ATS
    [Required(ErrorMessage = "{0}不能为空")]
    [StringLength(255, ErrorMessage = "{0}长度不能超过255")]
#endif
    public string OriginCode { get; set; }

    /// <summary>
    /// 是否准备就绪
    /// </summary>
    public EProductionStatus Status { get; set; }
}

public class TestManufacturingChangeStatusInput
{
    /// <summary>
    /// 外部编码。用于对接外部系统，如：MES
    /// </summary>
#if ATS
    [Required(ErrorMessage = "{0}不能为空")]
    [RegularExpression(GlobalOptions.RegexStrings.EnDigitUnderline, ErrorMessage = GlobalOptions.RegexStrings.EnDigitUnderlineError)]
#endif
    public string OriginCode { get; set; }

    /// <summary>
    /// 是否准备就绪
    /// </summary>
    public EProductionStatus Status { get; set; }
}

public class TestManufacturingItemDto : TestManufacturingCreateInput
{
    public string Id { get; set; }
}
